﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace NF_Tools
{
    public partial class BF_CricleNum : Control
    {
        public BF_CricleNum()
        {
            InitializeComponent();
            this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            this.BackColor = Color.Transparent;
        }


        private int messagenum = 25;

        [Browsable(true), Category("Pan"), Description("模拟菜单文字集合")]
        public int MessageNum
        {
            get { return messagenum; }
            set { messagenum = value; }
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            e.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;

            Brush pbr = new SolidBrush(Color.White);
            Brush b = new SolidBrush(Color.Red);

            Rectangle r = new Rectangle(0, 0, this.Width, this.Height);//标识圆的大小
            e.Graphics.FillEllipse(b, r);
            if (MessageNum > 10)
            {

                Font f = new Font("黑体", 12, FontStyle.Regular);
                this.ForeColor = Color.White;
                e.Graphics.DrawString("88", f, pbr, new Point(20 / 2 - 8, 20 / 2 - 6));
            }
            else
            {

                Font f = new Font("黑体", 14, FontStyle.Regular);
                this.ForeColor = Color.White;
                e.Graphics.DrawString("8", f, pbr, new Point(20 / 2 - 5, 20 / 2 - 7));
            }

            base.OnPaint(e);
        }
    }
}
